<template>
  <el-button type="primary"
             @click="handleReload">Key初始化</el-button>
  <el-button type="primary"
             @click="handleReload1">内置方法初始化</el-button>
  <br /><br />
  <avue-crud :key="reload"
             ref="crud"
             :data="data"
             :option="option"></avue-crud>

</template>
<script>
export default {
  data () {
    return {
      reload: Math.random(),
      data: [
        {
          username: 'smallwei',
          password: 'smallwei'
        }, {
          username: 'avue',
          password: 'avue'
        }
      ],
      option: {
        column: [
          {
            label: '用户名',
            prop: 'username'
          }, {
            label: '密码',
            prop: 'password',
            type: 'password'
          }
        ]
      },
    }
  },
  methods: {
    handleReload () {
      this.reload = Math.random();
      this.$message.success('初始化完成')
    },
    handleReload1 () {
      this.$refs.crud.refreshTable()
      this.$message.success('初始化完成')
    }
  }
}
</script>